{include file="admin/common/header" /}
<body>
<form class="layui-form" action="">
    <div class="mainBox">
        <div class="main-container">
            <div class="layui-form-item">
                <label class="layui-form-label required">系统名称</label>
                <div class="layui-input-block ">
                    <input type="text" name="admin_title" lay-verify="required" autocomplete="off"
                           placeholder="请输入系统名称"
                           class="layui-input" value="{$data.admin_title}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">网站名称</label>
                <div class="layui-input-block ">
                    <input type="text" name="title" lay-verify="required" autocomplete="off"
                           placeholder="请输入网站名称"
                           class="layui-input" value="{$data.title}">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label required">网站域名</label>
                    <div class="layui-input-block ">
                        <input type="text" name="domain" lay-verify="required|url" autocomplete="off"
                               placeholder="请输入网站域名"
                               class="layui-input" value="{$data.domain}">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label required">网站模板</label>
                    <div class="layui-input-block ">
                        <select name="template" lay-verify="required">
                            {foreach $template as $v}
                            <option value="{$v}"
                            <?php if($v==$data['template']) echo "selected"; ?>>{$v}</option>
                            {/foreach}
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">ICP备案号</label>
                    <div class="layui-input-block ">
                        <input type="text" name="icp" autocomplete="off"
                               placeholder="请输入ICP备案号"
                               class="layui-input" value="{$data.icp}">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">公安备案号</label>
                    <div class="layui-input-block ">
                        <input type="text" name="beian" autocomplete="off"
                               placeholder="请输入公安备案号"
                               class="layui-input" value="{$data.beian}">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">版权信息</label>
                <div class="layui-input-block ">
                    <input type="text" name="copyright" autocomplete="off"
                           placeholder="请输入版权信息"
                           class="layui-input" value="{$data.copyright}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">SEO关键词</label>
                <div class="layui-input-block ">
                    <input type="text" name="keywords" lay-verify="required" autocomplete="off"
                           placeholder="请输入SEO关键词"
                           class="layui-input" value="{$data.keywords}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">SEO描述</label>
                <div class="layui-input-block ">
                    <textarea class="layui-textarea" name="desc">{$data.desc}</textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">统计代码</label>
                <div class="layui-input-block">
                    <textarea class="layui-textarea" name="tongji">{$data.tongji}</textarea>
                </div>
            </div>

        </div>
    </div>
    <div class="bottom">
        <input type="hidden" name="id" value="{$data.id}">
        <div class="button-container">
            <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
                    lay-filter="admin-save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="pear-btn pear-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>

{include file="admin/common/footer" /}
<script>
  layui.use(['form', 'jquery'], function () {
    let form = layui.form;
    let $ = layui.jquery;

    form.render();

    form.on('submit(admin-save)', function (data) {
      $.ajax({
        url: "/app/huiblog/module/config/edit",
        data: JSON.stringify(data.field),
        dataType: 'json',
        contentType: 'application/json',
        type: 'post',
        success: function (res) {
          if (res.code === 200) {
            hui_msg(res.msg, 1, function () {
              window.location.reload();
            });
          } else {
            hui_msg(res.msg, 2);
          }
        }
      })
      return false;
    });
  })
</script>
<script>
</script>
</body>
</html>
